//==============================================================================
//
//            DTest - the (simple) Test class in the objc-site
//
//               Copyright (C) 2002  Dick van Oudheusden
//  
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free
// Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
//==============================================================================
// 
//  $Date: 2003-10-31 08:12:33 $ $Revision: 1.1 $
//
//==============================================================================

#include <stdlib.h>

#include "ofc/config.h"

#include "ofc/DBool.h"

#include "DInc.h"
#include "DTest.h"

//-DataTypes-------------------------------------------------------------------

void DBool_test()
{
  DBool *t    = [DBool alloc];
  DBool *f    = [[DBool alloc] init];
  char   tt[] = "Yes, It's going to be nice wetter";
  char   ft[] = "FALSE";
  char   wt[] = "hello";
  char  *pt;
  
  STARTTEST();

  TEST([[t init :YES] get] == YES);
   
  TEST([f get] == NO);
  
  TEST([[f set :YES] get] == YES);
  
  TEST([[t toText] ccompare :"YES"] == 0);
  
  [f set :NO];
  
  TEST([t compare :f] == 1);
  TEST([f compare :t] == -1);

  pt = tt;
  TEST([f fromString :&pt] == 0);
  TEST([f get] == YES);
  TEST(*pt == ',');

  pt = ft;
  TEST([f fromString :&pt] == 0);
  TEST([f get] == NO);

  pt = wt;
  TEST([f fromString :&pt] == ENODATA);
  TEST(*pt == 'h');

  STOPTEST();
} 
